package com.ly.count.impl.room.transfer;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ly.count.room.bo.CPlusRoomUserBO;
import com.ly.count.room.param.CPlusRoomUserPage;
import com.ly.count.room.po.CPlusRoomUser;
import com.ly.count.utils.GenIdUtils;
import com.ly.count.utils.LoginContextUtil;

import java.sql.Timestamp;

public class CPlusRoomUserTransfer {
    public static Page<CPlusRoomUser> toPage(CPlusRoomUserPage cPlusRoomPage) {
        Page<CPlusRoomUser> page = new Page<>();
        page.setTotal(cPlusRoomPage.getTotal());
        page.setCurrent(cPlusRoomPage.getCurrent());
        page.setSize(cPlusRoomPage.getSize());

        return page;
    }

    public static CPlusRoomUser toPO(CPlusRoomUserBO cPlusRoomUserBo) {
    	CPlusRoomUser cPlusRoomUser = new CPlusRoomUser();
    	cPlusRoomUser.setUserId(LoginContextUtil.getLoginContext().getUserId());
        cPlusRoomUser.setRoomName(cPlusRoomUserBo.getRoomName());
    	cPlusRoomUser.setRoomId(GenIdUtils.getId());
        cPlusRoomUser.setCreateTime(Timestamp.valueOf(String.valueOf(System.currentTimeMillis())));
    	return cPlusRoomUser;
    }
}
